<?php

/**
 * Framework_Presenter_debug
 *
 * @author      Joe Stump <joe@joestump.net>
 * @copyright   (c) 2006 Joseph C. Stump. All rights reserved.
 * @license http://www.opensource.org/licenses/bsd-license.php
 * @package Framework
 * @subpackage Presenter
 * @filesource
 */

/**
 * Framework_Presenter_debug
 *
 * Having problems with your application? Why not switch your module's 
 * presenter to 'debug' to view a bunch of useful output. 
 *
 * @author Joe Stump <joe@joestump.net>
 * @package Framework
 * @subpackage Presenter
 */
class Framework_Presenter_debug extends Framework_Presenter_Common
{
    /**
     * __construct
     *
     * @author Joe Stump <joe@joestump.net>
     * @access public
     * @param mixed $module Instance of Framework_Module
     * @return void
     */
    public function __construct(Framework_Module $module)
    {
        parent::__construct($module);
    }

    /**
     * display
     *
     * This function displays debugging information for our module. It's a 
     * good place to start when things go bonkers with your application.
     *
     * @author Joe Stump <joe@joestump.net>
     * @return void
     * @todo Add calls to display module, reflection as well.
     */
    public function display()
    {
        $vars = array(array('POST',$_POST),
        			  array('GET',$_GET),
        			  array('COOKIE',$_COOKIE),
        			  array('SESSION',$_SESSION),
        			  array('ENVIRONMENT',$_ENV),
        			  array('SERVER',$_SERVER));
        foreach ($vars as $var) {
            echo '<h2>$'.$var[0].'</h2>'."\n";
            echo '<pre>';
            var_dump($var[1]);
            echo '</pre>';
        }
        
        	
        
        
        $output = Framework::$module;
        $output = print_r($output,true);
        $output = '<h2>Module Dump</h2><pre>'.$output.'</pre>';
        echo $output.'<br><br>';
        
        $output = Framework::$site;
        $output = print_r($output, true);
        $output = '<h2>Site Dump</h2><pre>'.$output.'</pre>';
        echo $output;
        
        $output = $this->user;
        $output = print_r($output, true);
        $output = '<h2>User Dump</h2><pre>'.$output.'</pre>';
        echo $output;
        
        
    }

    /**
     * __destruct
     *
     * @access public
     * @return void
     */
    public function __destruct()
    {
        parent::__destruct();
    }
}

?>
